package 尊享面试.数组_字符串;

public class a1056易混淆数 {
    static class Solution {
        public boolean confusingNumber(int n) {
            int t = 0;
            int origin = n;
            while (n != 0) {
                int num = n % 10;
                if (num != 0 && num != 1 && num != 6 && num != 8 && num != 9) {
                    return false;
                }
                if (num == 6) {
                    num = 9;
                }else if (num == 9) {
                    num = 6;
                }
                t = t * 10 + num;
                n /= 10;
            }
            System.out.println(t);
            return t == origin;
        }
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.confusingNumber(6));
    }
}
